package com.yuandian.ops.workbench.controller;

import com.alibaba.cloud.commons.lang.StringUtils;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.ops.workbench.po.AlarmListParams;
import com.yuandian.ops.workbench.service.ISystemTrendAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  系统趋势分析Controller
 * <p>
 *
 * @author linshihe
 * @date 2021/12/17
 */
@RestController
@RequestMapping("/ywgzt/systemTrendAnalysis")
@Api(tags = "系统趋势分析-Controller")
public class SystemTrendAnalysisController {

    @Autowired
    private ISystemTrendAnalysisService systemTrendAnalysisService;


    /**
     * 获取指定系统下业务的增量比TOP10
     * @param params 请求参数
     * @return
     */
	@ApiOperation(value = "二级-首页-中间底部折线图-下钻-业务增量比列表", notes = "二级-首页-中间底部折线图-下钻-业务增量比列表")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "systemId", 				value = "系统id",  			paramType = "query", required = false,  dataType = "Integer"),
			@ApiImplicitParam(name = "orderByColumn", 			value = "排序字段", 			paramType = "query", required = false,  dataType = "String"),
			@ApiImplicitParam(name = "isAsc", 					value = "升降序:ASC，DESC",  paramType = "query",  required = false, dataType = "String"),
			@ApiImplicitParam(name = "startTime", 				value = "开始时间", 			paramType = "query", required = true,   dataType = "String"),
			@ApiImplicitParam(name = "endTime", 				value = "结束时间", 			paramType = "query", required = true,   dataType = "String")
	})
    @PostMapping("/getIncrementRatioList")
    public R<Object> getIncrementRatioList(@RequestBody AlarmListParams params){
        if (params == null || StringUtils.isEmpty(params.getStartTime()) || StringUtils.isEmpty(params.getEndTime())) {

            return R.failed("参数不能为空");
        }
        return systemTrendAnalysisService.getIncrementRatioList(params);
    }


}
